package com.design.pattern.adapter.test;


import java.util.List;


/**
 * 适配器类，实现V2接口,调用V1接口前打印一下日志
 *
 */
public class V2AdapterImpl implements V2Service {

    /**
     * 通过构造函数把源传递到适配器类中
     */
    private V1Service v1Service;
    public V2AdapterImpl(V1Service v1Service) {
        this.v1Service = v1Service;
    }

    @Override
    public void save(List<Integer> list, String name) {
        System.out.println("打印一下日志："+name);
        //保持以前V1接口的功能
        v1Service.save(list);
    }

}
